import plugin from'../../lib/plugins/plugin.js'
import{segment}from'oicq'
import cfg from'../../lib/config/config.js'
import common from'../../lib/common/common.js'
const list = [1832304454,3063663095]//白名单账号


export class example extends plugin{
    constructor(){
        super({
            name: '主人解禁',
            dsc: '顾名思义',
            event: 'notice.group.ban',
            priority: -9999,
            rule:[
                {
                    /** 命令正则匹配 */
                    fnc:'jiejin'
                },
                {
                    reg:'#增加白名单.*}',
                    fnc:'tj'
                }
        ]
        
        })
    }
    async jiejin(e){
        logger.info('[有人被禁言生效]')
        // if (config.get('wlist')) {
        //     if (config.get('wlist').some(item => qq.includes(item))) {
        //         e.reply('这样是不对的！')
        //         await common.sleep(1000)
        //         await e.group.muteMember(e.user_id,0)
        //     }
        //   }
        if (e.duration === 0) { return false }    
        if(list.includes(e.user_id)){
            e.reply('言灵：破除小黑屋喵！！')
            await common.sleep(2000)
            await e.group.muteMember(e.user_id,0)}
        if (!e.isMaster ){return false} 
        
        if (!e.group.is_admin && !e.group.is_owner) {
            await this.reply('惨兮兮~')
            return false
        }


      if (Bot[e.self_id].pickGroup(e.group_id).is_admin || e.group.is_owner) {


        e.reply('主人我来救你了！！！')
        await e.group.muteMember(e.user_id, 0)
        return false
      } else {
          e.reply('爱莫能助了喵..')
          return false
      }
    }

}